import pytest


# pytest参数化处理

data1 = ['123', '456']
@pytest.mark.parametrize('pwd', data1)
def test_pwd(pwd):
    print(pwd)


data2 = [
    (1, 2, 3),
    (4, 5, 6)
]
@pytest.mark.parametrize('a,b,c',data2)
def test2(a, b, c):
    print(a, b, c)


data3 = (
    {
         'username': 123,
         'pwd': 123
     },

    {
        'username': 456,
        'pwd': 456
    }
)
@pytest.mark.parametrize('dict', data3)
def test3(dict):
    print(dict)


data4 = [
    pytest.param(1,2,3, id="(a+b):pass"),
    pytest.param(5,5,10, id="(a+b):pass")
]


def add(a, b):
    return a+b

class TestParametrize(object):
    @pytest.mark.parametrize('a,b, expected', data4)
    def test4(self, a, b, expected):
        assert add(a,b) == expected


